package git.bds.nyc.product.mapper.mp;

import git.bds.nyc.product.model.domain.CorpProcessingProduct;
import com.github.yulichang.base.MPJBaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.math.BigDecimal;

/**
 * <p>
 * 加工产品表 Mapper 接口
 * </p>
 *
 * @author 成大事
 * @since 2022-10-26 11:43:50
 */
@Mapper
public interface CorpProcessingProductMapper extends MPJBaseMapper<CorpProcessingProduct> {

    /**
     * 恢复原始重量
     *
     * @param productId   产品id
     * @param orderWeight 订单重量
     * @return int
     */
    @Update("UPDATE corp_processing_product SET product_weight = product_weight + #{orderWeight} WHERE id = #{productId}")
    int restoreOriginalWeight(@Param("productId") Long productId, @Param("orderWeight") BigDecimal orderWeight);
}
